package com.ideal.hbase.client;

import java.nio.charset.Charset;

import org.apache.hadoop.conf.Configuration;
import org.springframework.util.StringUtils;

import com.ideal.hbase.client.constants.HbaseConstants;
import com.ideal.hbase.client.core.TableFactory;

public abstract class HbaseAccessor {

	private String encoding;

	private TableFactory tableFactory;
	private Configuration configuration;

	public void setTableFactory(TableFactory tableFactory) {
		this.tableFactory = tableFactory;
	}

	public void setEncoding(String encoding) {
		this.encoding = encoding;
	}

	public void setConfiguration(Configuration configuration) {
		this.configuration = configuration;
	}

	public TableFactory getTableFactory() {
		return tableFactory;
	}

	public Configuration getConfiguration() {
		return configuration;
	}

	public Charset getCharset() {
		return (StringUtils.hasText(encoding) ? Charset.forName(encoding)
				: HbaseConstants.CHARSET);
	}
}